﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"  CodeFile="AdminPage.aspx.cs" Inherits="AdminPage" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">  
    <h4 class="auto-style1">Pagina de administrare</h4>
<div class="hr dotted clearfix">&nbsp;</div>

    <ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true" ID="ScriptManager1" ScriptMode="Debug" CombineScripts="false" />
   
    <asp:Panel ID="templateZIPanel" runat="server" Visible="False">
        &nbsp;
        <asp:Button ID="addNewTemplateZiButton" runat="server" Text="New Template Zi" onclick="addNewTemplateZiButton_Click"  CssClass="button" />
        <br />
        <br />
        
        <table>
            <tr> 
                <td> 
                    <asp:Label ID="Label31" runat="server" Text="Consulatul :"></asp:Label>
                </td>
                <td>   
                    <asp:DropDownList ID="templateZiConsulatSelector" runat="server" Height="24px" 
                        Width="430px"  AutoPostBack="True" 
                        onselectedindexchanged="templateZiConsulatSelector_SelectedIndexChanged">  </asp:DropDownList>
                </td> 
            </tr>            
            <tr>
                <td>
                    <asp:CheckBox ID="templateZIUseWeekFilterCheckBox" runat="server" Text="Use Week Filter" AutoPostBack="True" oncheckedchanged="templateZIUseWeekFilterCheckBox_CheckedChanged"/>
                </td>
                <td>
                    <asp:DropDownList ID="templateZiZiSaptaminaDropDownList" runat="server" 
                        Height="24px" Width="200px" Enabled="False" AutoPostBack="True" 
                        onselectedindexchanged="templateZiZiSaptaminaDropDownList_SelectedIndexChanged" >  
                        <asp:ListItem Value="1">Luni</asp:ListItem>
                        <asp:ListItem Value="2">Marti</asp:ListItem>
                        <asp:ListItem Value="3">Miercuri</asp:ListItem>
                        <asp:ListItem Value="4">Joi</asp:ListItem>
                        <asp:ListItem Value="5">Vineri</asp:ListItem>
                        <asp:ListItem Value="6">Simbata</asp:ListItem>
                        <asp:ListItem Value="7">Duminica</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>

            <tr>
                <td>
                    <asp:CheckBox ID="templateZiUseServiceFilterCheckBox" runat="server" Text="Use Service Filter" AutoPostBack="True" oncheckedchanged="templateZiUseServiceFilterCheckBox_CheckedChanged"/>
                    &nbsp;</td>
                <td>
                    <asp:DropDownList ID="templateZiServiceDDL" runat="server" Height="24px" Width="200px" Enabled="False" AutoPostBack="True" onselectedindexchanged="templateZiServiceDDL_SelectedIndexChanged" >  </asp:DropDownList>
                </td>
            </tr>
        </table>
        <br />
        <strong>
        <asp:Label ID="Label30" runat="server" Text="Template ZI">  </asp:Label>
        <br />
        </strong>

        <asp:GridView ID="templateZIGridView" runat="server" 
            CellPadding="4" 
            EnableModelValidation="True" 
            HorizontalAlign="Justify" 
            AutoGenerateColumns="False" 
            CssClass="mGrid"
            PagerStyle-CssClass="pgr"
            AlternatingRowStyle-CssClass="alt"
            Width="100%" 
            AllowPaging="True" 
            PageSize="20" onrowdeleting="templateZIGridView_RowDeleting" 
            onrowediting="templateZIGridView_RowEditing" 
            onpageindexchanging="templateZIGridView_PageIndexChanging">
            
            <Columns>
                <asp:BoundField DataField="ID Template"     HeaderText="ID Template"        HtmlEncode="False"  HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />  
                <asp:BoundField DataField="ID Consulat"        HeaderText="ID Consulat"           HtmlEncode="False"  HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />  
                <asp:BoundField DataField="Zi Saptamina"        HeaderText="Zi Saptamina"           HtmlEncode="False"/>  
                <asp:BoundField DataField="ID Service"        HeaderText="ID Service"           HtmlEncode="False"  HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />  
                <asp:BoundField DataField="Service"        HeaderText="Service"           HtmlEncode="False"/>  
                <asp:BoundField DataField="Start Hour"        HeaderText="Start Hour"           HtmlEncode="False"/>  
                <asp:BoundField DataField="End Hour"        HeaderText="End Hour"           HtmlEncode="False"/> 
                <asp:BoundField DataField="Max Person"        HeaderText="Max Person"           HtmlEncode="False"/>        
                <asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" ControlStyle-CssClass="button" />
                <asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete" ControlStyle-CssClass="button" />
            </Columns>           
        </asp:GridView>

    </asp:Panel>

    <asp:Panel ID="addNewTemplateZiPanel" runat="server" Visible="False">
        
        <table> 
            <tr>
                <td align="right"> 
                    <asp:Label ID="Label32" runat="server" Text="Consulatul :"></asp:Label>
                </td>
                <td>   
                    <asp:DropDownList ID="addNewTemplateZiConsulatDDL" runat="server" Height="24px" 
                        Width="430px" style="margin-left: 9px"  />
                </td> 
            </tr>

            <tr>
                <td>
                    <asp:RadioButton ID="addNewTemplateZiOneBYOneRadioButton" runat="server" 
                        AutoPostBack="true" Text="Cite unul" Checked="True" 
                        oncheckedchanged="addNewTemplateZiOneBYOneRadioButton_CheckedChanged" />
                </td>
                <td>
                    <table>                                                                                                                                <tr>
                            <td>
                                <asp:Label ID="Label33" runat="server" Text="Ziua săptămânii :"></asp:Label>
                            </td>
                            <td>
                                <asp:DropDownList ID="addNewTemplateZiZiSaptaminaDropDownList" runat="server" 
                                    Height="24px" Width="159px" >  
                                    <asp:ListItem Value="1">Luni</asp:ListItem>
                                    <asp:ListItem Value="2">Marti</asp:ListItem>
                                    <asp:ListItem Value="3">Miercuri</asp:ListItem>
                                    <asp:ListItem Value="4">Joi</asp:ListItem>
                                    <asp:ListItem Value="5">Vineri</asp:ListItem>
                                    <asp:ListItem Value="6">Simbata</asp:ListItem>
                                    <asp:ListItem Value="7">Duminica</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                                                                                                        <tr>
                            <td>
                                <asp:Label ID="Label34" runat="server" Text="Service :"></asp:Label>
                            </td>
                
                            <td>
                                <asp:DropDownList ID="addNewTemplateZiServiceCategoryDDL" runat="server" 
                                    Height="24px" Width="159px" AutoPostBack="True"/>
                            </td>
                        </tr>
                                                                                                                                                                                                                                                        <tr>
                            <td>
                                <asp:Label ID="Label39" runat="server" Text="Start Hour: "></asp:Label>
                            </td>
                            <td>                    
                                <asp:TextBox runat="server" ID="addNewTemplateZiStartHourTextBox" Width="130px" ValidationGroup="MKE" ></asp:TextBox>
                                <ajaxToolkit:MaskedEditExtender ID="addNewTemplateZiStartHourMaskedEditExtender" runat="server"
                                    TargetControlID="addNewTemplateZiStartHourTextBox" 
                                    Mask="99:99"
                                    MessageValidatorTip="true"
                                    OnFocusCssClass="MaskedEditFocus"
                                    OnInvalidCssClass="MaskedEditError"
                                    MaskType="Time"
                                    AcceptAMPM="True"
                                    ErrorTooltipEnabled="True" />
                                <ajaxToolkit:MaskedEditValidator ID="addNewTemplateZiStartHourMaskedEditValidator" runat="server"
                                    ControlExtender="addNewTemplateZiStartHourMaskedEditExtender"
                                    ControlToValidate="addNewTemplateZiStartHourTextBox"
                                    IsValidEmpty="False"
                                    EmptyValueMessage="Introduceti va rog Timpul"
                                    InvalidValueMessage="Timp incorect"
                                    Display="Dynamic"
                                    TooltipMessage="Introduceti timpul"
                                    EmptyValueBlurredText="*"
                                    InvalidValueBlurredMessage="*"
                                    ValidationGroup="MKE"/>                 
                            </td>
                        </tr>
            
                                                                                                                                                                                                                                                            <tr>
                            <td>
                                <asp:Label ID="Label46" runat="server" Text="End Hour: "></asp:Label>
                            </td>
                            <td>                    
                                <asp:TextBox runat="server" ID="addNewTemplateZiEndHourTextBox" Width="130px" ValidationGroup="MKE"></asp:TextBox>
                                <ajaxToolkit:MaskedEditExtender ID="addNewTemplateZiEndHourMaskedEditExtender" runat="server"
                                    TargetControlID="addNewTemplateZiEndHourTextBox" 
                                    Mask="99:99"
                                    MessageValidatorTip="true"
                                    OnFocusCssClass="MaskedEditFocus"
                                    OnInvalidCssClass="MaskedEditError"
                                    MaskType="Time"
                                    AcceptAMPM="True"
                                    ErrorTooltipEnabled="True" />
                                <ajaxToolkit:MaskedEditValidator ID="addNewTemplateZiEndHourMaskedEditValidator" runat="server"
                                    ControlExtender="addNewTemplateZiEndHourMaskedEditExtender"
                                    ControlToValidate="addNewTemplateZiEndHourTextBox"
                                    IsValidEmpty="False"
                                    EmptyValueMessage="Introduceti va rog Timpul"
                                    InvalidValueMessage="Timp incorect"
                                    Display="Dynamic"
                                    TooltipMessage="Introduceti timpul"
                                    EmptyValueBlurredText="*"
                                    InvalidValueBlurredMessage="*"
                                    ValidationGroup="MKE"/>      
                            </td>
                        </tr>
            
                                                                                            <tr>
                            <td>
                                <asp:Label ID="Label47" runat="server" Text="Max persoane: "></asp:Label>
                            </td>
                            <td>
                                <asp:TextBox ID="addNewTemplateZiMaxPersonTextBox" runat="server"></asp:TextBox>
                            </td>
                        </tr>
            
                    </table>
                        <asp:Button ID="addNewTemplateZiSaveButton" runat="server" Text="Save" onclick="addNewTemplateZiSaveButton_Click"  CssClass="button" />
                                &nbsp;&nbsp;  
                        <asp:Label ID="Label38" runat="server" Text="OR"></asp:Label>
                                &nbsp;&nbsp;
                        <asp:Button ID="addNewTemplateZiCancelButton" runat="server" Text="Cancel"  onclick="addNewTemplateZiCancelButton_Click" CssClass="button"  />  
                </td>
            </tr>
            
            <tr>
                <td colspan=2 align="center">
                    <asp:Label ID="Label8" runat="server" Text="-------------------------------------------------------------------------------------------------------------------------------------------------------------"></asp:Label>
                </td>
            </tr>

            <tr>
                
                <td>
                    <asp:RadioButton ID="addNewTemplateFromDefaultTemplateRadioButton" 
                        runat="server" AutoPostBack="true" Text="Din DEFAULT Template" 
                        oncheckedchanged="addNewTemplateFromDefaultTemplateRadioButton_CheckedChanged" />
                </td>

                <td>
                    <br/>
                    <asp:Label ID="Label7" runat="server" 
                        Text="Atentie! Aplicarea DEFAULT TEMPLATE poate fi posibilă doar dacă CONSULATUL nu are salvat un Template!" 
                        Enabled="False"></asp:Label>
                    <br/>
                    <asp:Label ID="Label6" runat="server" Text="Alege Template-ul existent:" 
                        Enabled="False"></asp:Label>&nbsp;&nbsp; 
                    <asp:DropDownList ID="addNewTemplateFromDefaultTemplateDDL" runat="server" 
                        Enabled="False" Width="147px">
                    </asp:DropDownList>

                    <br/><br/>
                    <asp:Button ID="addNewTemplateFromDefaultTemplateSaveButton" runat="server" 
                        Text="Save" onclick="addNewTemplateFromDefaultTemplateSaveButton_Click"  
                        CssClass="button" Enabled="False" />
                            &nbsp;&nbsp;  
                    <asp:Label ID="Label5" runat="server" Text="OR"></asp:Label>
                            &nbsp;&nbsp;
                    <asp:Button ID="addNewTemplateFromDefaultTemplateCancelButton" runat="server" 
                        Text="Cancel"  onclick="addNewTemplateFromDefaultTemplateCancelButton_Click" 
                        CssClass="button" Enabled="False"  />  
                </td>
            </tr>
        </table>
        
      

                      
    </asp:Panel>

    <asp:Panel ID="editTemplateZiPanel" runat="server" Visible="False">
        <table>
            <tr>
                <td>
                    <asp:Label ID="Label60" runat="server" Text="ID :"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="editTemplateZiIDLabel" runat="server" Text="" Enabled = "false" ></asp:Label>
                </td>
            </tr>
            <tr> 
                <td> 
                    <asp:Label ID="Label50" runat="server" Text="Consulatul :"></asp:Label>
                </td>
                <td>   
                    <asp:DropDownList ID="editTemplateZiConsulatDDL" runat="server" Height="24px" Width="430px"  />
                </td> 
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label51" runat="server" Text="Ziua Saptaminii :"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="editTemplateZiZiSaptaminaDDL" runat="server" 
                        Height="24px" Width="159px" >  
                        <asp:ListItem Value="1">Luni</asp:ListItem>
                        <asp:ListItem Value="2">Marti</asp:ListItem>
                        <asp:ListItem Value="3">Miercuri</asp:ListItem>
                        <asp:ListItem Value="4">Joi</asp:ListItem>
                        <asp:ListItem Value="5">Vineri</asp:ListItem>
                        <asp:ListItem Value="6">Simbata</asp:ListItem>
                        <asp:ListItem Value="7">Duminica</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label55" runat="server" Text="Service Category :"></asp:Label>
                </td>
                
                <td>
                    <asp:DropDownList ID="editTemplateZiServiceCategoryDDL" runat="server" 
                        Height="24px" Width="159px" AutoPostBack="True" />
                </td>
            </tr>
          
            <tr>
                <td>
                    <asp:Label ID="Label57" runat="server" Text="Start Hour: "></asp:Label>
                </td>
                <td>                    
                    <asp:TextBox runat="server" ID="editTemplateZiStartHourTextBox" Width="130px" ValidationGroup="MKE" ></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="editTemplateZiStartHourMaskedEditExtender" runat="server"
                        TargetControlID="editTemplateZiStartHourTextBox" 
                        Mask="99:99"
                        MessageValidatorTip="true"
                        OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError"
                        MaskType="Time"
                        AcceptAMPM="True"
                        ErrorTooltipEnabled="True" />
                    <ajaxToolkit:MaskedEditValidator ID="editTemplateZiStartHourMaskedEditValidator" runat="server"
                        ControlExtender="editTemplateZiStartHourMaskedEditExtender"
                        ControlToValidate="editTemplateZiStartHourTextBox"
                        IsValidEmpty="False"
                        EmptyValueMessage="Introduceti va rog Timpul"
                        InvalidValueMessage="Timp incorect"
                        Display="Dynamic"
                        TooltipMessage="Introduceti timpul"
                        EmptyValueBlurredText="*"
                        InvalidValueBlurredMessage="*"
                        ValidationGroup="MKE"/>      
                </td>
            </tr>
            
             <tr>
                <td>
                    <asp:Label ID="Label61" runat="server" Text="End Hour: "></asp:Label>
                </td>
                <td>                    
                    <asp:TextBox runat="server" ID="editTemplateZiEndHourTextBox" Width="130px" ValidationGroup="MKE" ></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="editTemplateZiEndHourMaskedEditExtender" runat="server"
                        TargetControlID="editTemplateZiEndHourTextBox" 
                        Mask="99:99"
                        MessageValidatorTip="true"
                        OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError"
                        MaskType="Time"
                        AcceptAMPM="True"
                        ErrorTooltipEnabled="True" />
                    <ajaxToolkit:MaskedEditValidator ID="editTemplateZiEndHourMaskedEditValidator" runat="server"
                        ControlExtender="editTemplateZiEndHourMaskedEditExtender"
                        ControlToValidate="editTemplateZiEndHourTextBox"
                        IsValidEmpty="False"
                        EmptyValueMessage="Introduceti va rog Timpul"
                        InvalidValueMessage="Timp incorect"
                        Display="Dynamic"
                        TooltipMessage="Introduceti timpul"
                        EmptyValueBlurredText="*"
                        InvalidValueBlurredMessage="*"
                        ValidationGroup="MKE"/>     
                </td>
            </tr>
            
             <tr>
                <td>
                    <asp:Label ID="Label63" runat="server" Text="Max Person: "></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="editTemplateZiMaxPersonTextBox" runat="server"></asp:TextBox>
                </td>
            </tr>
            
        </table>

        <asp:Button ID="editTemplateZiSaveButton" runat="server" Text="Save" 
             onclick="editTemplateZiSaveButton_Click"  />

        &nbsp;&nbsp;  

        <asp:Label ID="Label64" runat="server" Text="OR"></asp:Label>

        &nbsp;&nbsp;

        <asp:Button ID="editTemplateZiCancelButton" runat="server" Text="Cancel"  
             onclick="editTemplateZiCancelButton_Click"  CssClass="button" />                        
    </asp:Panel>

    <asp:Panel ID="calendarPanel" runat="server" Visible="False">
        <asp:Button ID="fillFromTemplateButton" runat="server"  Text="Umple Calendarul din Template" onclick="fillFromTemplateButton_Click"   />
        <br />
        <br />
                <table>
                    <tr> 
                        <td> 
                            <asp:Label ID="Label65" runat="server" Text="Consulatul :"></asp:Label>
                        </td>
                        <td>   
                            <asp:DropDownList ID="calendarConsulatDDL" runat="server" Height="24px" 
                                Width="401px"  AutoPostBack="True" 
                                ontextchanged="calendarConsulatDDL_TextChanged" >  </asp:DropDownList>
                        </td> 
                        <td>
                        </td>
                    </tr>

                    <tr>
                        <td>
                            <asp:Label ID="Label67" runat="server" Text="Data de la: "></asp:Label>
                            <br />
                            <asp:TextBox ID="calendarDateFromTextBox" runat="server"></asp:TextBox>
                            <ajaxToolkit:CalendarExtender ID="calendarDateFromCalendarExtender" runat="server"  TargetControlID="calendarDateFromTextBox" />
                        </td>

                        <td>
                            <asp:Label ID="Label68" runat="server" Text="Data până la: "></asp:Label>
                            <br />
                            <asp:TextBox ID="calendarDateToTextBox" runat="server"></asp:TextBox>
                            <ajaxToolkit:CalendarExtender ID="calendarDateToCalendarExtender" runat="server"  TargetControlID="calendarDateToTextBox" />
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <asp:Button ID="calendarShowButton" runat="server" CssClass="button" 
                                onclick="calendarShowButton_Click" Text="Show" />
                        </td> 
                        <td>
                            &nbsp;</td>
                    </tr>
                </table>

                <br />

                <table >
                    <tr>
                        <td>
                            <asp:CheckBox ID="calendarSelectAllRecordsFromPeriodCheckBox" runat="server" 
                                Text="Selecteaza toata perioada "  AutoPostBack="true"
                                OnCheckedChanged="calendarSelectAllRecordsFromPeriodCheckBox_CheckedChanged" />
                        </td>
                        <td>
                             <asp:Button ID="saveStatutAprobareFromPeriodButton" runat="server" CssClass="button" 
                                onclick="saveStatutAprobareFromPeriodButton_Click" 
                                Text="Aproba statut" />
                        </td>
                    </tr>
                </table>
                       <br />
                <hr />
                       <br />
                <table>
                    <tr>
                        <td>
                            <asp:CheckBox ID="calendarSelectAllRecordsCheckBox" runat="server" 
                                AutoPostBack="true" 
                                oncheckedchanged="calendarSelectAllRecordsCheckBox_CheckedChanged" 
                                Text="Selecteaza pagina curenta " />
                        </td>
                        <td >
                            <asp:Button ID="calendarApproveButton" runat="server" 
                                Text="Aproba statut" onclick="calendarApproveButton_Click" 
                                CssClass="button" />
                        </td>
                    </tr>

                </table>


                <br />
                <br />

                <strong>
                <asp:Label ID="Label66" runat="server" Text="Calendar">  </asp:Label>
                <br />
                <br />
                </strong>
                <asp:GridView ID="calendarGridView" runat="server" 
                    CellPadding="4" 
                    EnableModelValidation="True" 
                    HorizontalAlign="Justify" 
                    AutoGenerateColumns="False" 
                    CssClass="mGrid"
                    PagerStyle-CssClass="pgr"
                    AlternatingRowStyle-CssClass="alt"
                    Width="100%" 
                    AllowPaging="True" 
                    PageSize="20" onrowdeleting="calendarGridView_RowDeleting" 
                    onrowediting="calendarGridView_RowEditing" 
                    onpageindexchanging="calendarGridView_PageIndexChanging">
            
                    <AlternatingRowStyle CssClass="alt" />
                    <Columns>
                       
                        <asp:TemplateField HeaderText="Status Aprobare">
                            <ItemTemplate>
                                <asp:CheckBox ID="StatusAprobare" runat="server"
                                    Checked='<%# Convert.ToBoolean(Eval("Status Aprobare")) %>'
                                    Text='<%# Eval("Status Aprobare").ToString().Equals("True") ? "Approved" : "Not Approved" %>' />
                            </ItemTemplate>                   
                        </asp:TemplateField>            
            
                        <asp:BoundField DataField="ID Calendar" HeaderText="ID Calendar" HtmlEncode="False"  HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />
                        <asp:BoundField DataField="ID Consulat" HeaderText="ID Consulat" HtmlEncode="False"  HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />
                        <asp:BoundField DataField="Consulat" HeaderText="Consulat" HtmlEncode="False"  HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />

                        <asp:TemplateField HeaderText="Data">
                            <ItemTemplate>
                                <asp:Label ID="Datalabel" runat="server" Text='<%# ((Eval("Data") != null && Eval("Data") is DateTime) ?  ((DateTime)Eval("Data")).ToShortDateString() : "") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>

                        <asp:BoundField DataField="Zi Saptamina" HeaderText="Zi Saptamina" HtmlEncode="False" />
                        <asp:BoundField DataField="Service" HeaderText="Service" HtmlEncode="False" />
                        <asp:BoundField DataField="Start Hour" HeaderText="Start Hour" HtmlEncode="False" />
                        <asp:BoundField DataField="End Hour" HeaderText="End Hour" HtmlEncode="False" />
                        <asp:BoundField DataField="Locuri Libere" HeaderText="Locuri Libere" HtmlEncode="False" />
                        <asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" ControlStyle-CssClass="button" />
                        <asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete" ControlStyle-CssClass="button" />
                    </Columns>
                    <PagerStyle CssClass="pgr" />
                </asp:GridView>

    </asp:Panel>

    <asp:Panel ID="editCalendarPanel" runat="server" Visible="False">
        <table>
            <tr>
                <td>
                    <asp:Label ID="Label69" runat="server" Text="Calendar ID :"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="editCalendarIDLabel" runat="server" Text="" Enabled = "false" ></asp:Label>
                </td>
            </tr>
            <tr> 
                <td> 
                    <asp:Label ID="Label71" runat="server" Text="Consulatul :"></asp:Label>
                </td>
                <td>   
                    <asp:Label ID="editCalendarConsulatLabel" runat="server" Text="" Enabled = "false" ></asp:Label>
                </td> 
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label70" runat="server" Text="Data :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="editCalendarDataTextBox" runat="server"></asp:TextBox>
                    <ajaxToolkit:CalendarExtender ID="editCalendarExtender" runat="server" TargetControlID="editCalendarDataTextBox" />
                </td>            
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label72" runat="server" Text="Ziua Săptămânii :"></asp:Label>
                </td>
                <td>
                    <asp:Label ID="editCalendarZiSaptaminaLabel" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label73" runat="server" Text="Service: "></asp:Label>
                </td>
                
                <td>
                    <asp:Label ID="editCalendarServiceLabel" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            
            <tr>
                <td>
                    <asp:Label ID="Label74" runat="server" Text="Hours :"></asp:Label>
                </td>
                
                <td>
                    <asp:Label ID="editCalendarStartEndHoursLabel" runat="server" Text=""></asp:Label>
                </td>
            </tr>
            
            <tr>
                <td>
                    <asp:Label ID="Label75" runat="server" Text="Locuri libere: "></asp:Label>
                </td>
                <td>                   
                    <asp:TextBox ID="editCalendarLocuriLibereTextBox" runat="server"></asp:TextBox>
                </td>
            </tr>
            
             <tr>
                <td>
                    <asp:Label ID="Label77" runat="server" Text="Status Aprobare: "></asp:Label>
                </td>
                <td>
                    <asp:CheckBox ID="editCalendarStatusAprobareCheckBox" runat="server" />
                </td>                 
            </tr>     
        </table>

        <asp:Button ID="editCalendarSaveButton" runat="server" Text="Save"  onclick="editCalendarSaveButton_Click"  CssClass="button" />

        &nbsp;&nbsp;  

        <asp:Label ID="Label80" runat="server" Text="OR"></asp:Label>

        &nbsp;&nbsp;

        <asp:Button ID="editCalendarcancelButton" runat="server" Text="Cancel"  onclick="editCalendarCancelButton_Click"  CssClass="button" />                        
    </asp:Panel>

    <asp:Panel ID="fillFromTemplatePanel" runat="server" Visible="False">
        <asp:UpdatePanel ID="panleUpd" runat="server" >
            <ContentTemplate>
                <table>            
                    <tr> 
                        <td align="right"> 
                            <asp:Label ID="Label799" runat="server" Text="Consulatul :"></asp:Label>
                        </td>
                        <td>   
                            <asp:DropDownList ID="fillFromTemplateConsulatDDL" runat="server" Height="24px" 
                                Width="430px"  AutoPostBack="True" 
                                OnSelectedIndexChanged="fillFromTemplateConsulatDDL_SelectedIndexChanged" >  </asp:DropDownList>
                        </td>                         
                    </tr>
                    <tr> 
                        <td align="right"> 
                            <asp:Label ID="Label79" runat="server" Text="Serviciul :"></asp:Label>
                        </td>
                        <td>   
                            <asp:DropDownList ID="fillFromTemplateServiceDDL" runat="server" Height="24px" 
                                Width="159px" AutoPostBack="True" 
                                onselectedindexchanged="fillFromTemplateServiceDDL_SelectedIndexChanged"  />
                        </td>                        
                    </tr>

                    <tr>
                        <td>
                            <asp:Label ID="Label82" runat="server" Text="Incepid de la :"></asp:Label>
                            <asp:TextBox ID="fillCalendarFromTemplateBeginFromTextBox" runat="server" Enabled="false" Width="100px"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Label ID="Label9" runat="server" Text="Pina la data :"></asp:Label>
                            <asp:TextBox ID="fillCalendarFromTemplateEndTextBox" runat="server" Width="100px"></asp:TextBox>
                            <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="fillCalendarFromTemplateEndTextBox"  />
                        </td>            
                    </tr>     
            
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:Button ID="fillFromTemplateSaveButton" runat="server" Text="Save" onclick="fillFromTemplateSaveButton_Click"  CssClass="button" />

        &nbsp;&nbsp;  

        <asp:Label ID="Label91" runat="server" Text="OR"></asp:Label>

        &nbsp;&nbsp;

        <asp:Button ID="fillFromTemplateCancelButton" runat="server" Text="Cancel"   
            onclick="fillFromTemplateCancelButton_Click" CssClass="button"  />                        
    </asp:Panel>

    <asp:Panel ID="HolyDaysPanel" runat="server" Visible="False">
        &nbsp;
        <asp:Button ID="addNewHoliday" runat="server" Text="Adauga o Sarbatoare noua"  
            onclick="addNewHoliday_Click"  CssClass="button" />
        <br />
        <br />
        
        <table>
            <tr> 
                <td> 
                    <asp:Label ID="Label35" runat="server" Text="Consulatul :"></asp:Label>
                </td>
                <td>   
                    <asp:DropDownList ID="holidayConsulatDDL" runat="server" Height="24px" 
                        Width="430px"  AutoPostBack="True" 
                        onselectedindexchanged="holidayConsulatDDL_SelectedIndexChanged">  </asp:DropDownList>
                </td> 
            </tr>
        </table>
        <br />
        <strong>
        <asp:Label ID="Label56" runat="server" Text="Lista Sărbătorilor"></asp:Label>
        <br />
        </strong>

        <asp:GridView ID="holidaysGridView" runat="server" 
            CellPadding="4" 
            EnableModelValidation="True" 
            HorizontalAlign="Justify" 
            AutoGenerateColumns="False" 
            CssClass="mGrid"
            PagerStyle-CssClass="pgr"
            AlternatingRowStyle-CssClass="alt"
            Width="100%" 
            AllowPaging="True" 
            PageSize="20" onrowdeleting="holidaysGridView_RowDeleting" 
            onrowediting="holidaysGridView_RowEditing" 
            onpageindexchanging="holidaysGridView_PageIndexChanging">
            
            <Columns>
                <asp:BoundField DataField="ID Consulat"        HeaderText="ID Consulat"           HtmlEncode="False"  HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn" />  
                <asp:BoundField DataField="Consulat"        HeaderText="Consulat"           HtmlEncode="False" HeaderStyle-CssClass="hideGridColumn" ItemStyle-CssClass = "hideGridColumn"/>                  

                <asp:TemplateField HeaderText="Data">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# ((Eval("Data") != null && Eval("Data") is DateTime) ?  ((DateTime)Eval("Data")).ToShortDateString() : "") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:BoundField DataField="Work Time From"        HeaderText="Work Time From"           HtmlEncode="False"/>  
                <asp:BoundField DataField="Work Time To"        HeaderText="Work Time To"           HtmlEncode="False"/> 
                <asp:BoundField DataField="Work Hours"        HeaderText="Work Hours"           HtmlEncode="False"/>        
                <asp:ButtonField ButtonType="Button" CommandName="Edit" Text="Edit" ControlStyle-CssClass="button" />
                <asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete" ControlStyle-CssClass="button" />
            </Columns>           
        </asp:GridView>




    </asp:Panel>

    <asp:Panel ID="editHolidaysPanel" runat="server" Visible="False">
        <table>            
            <tr> 
                <td> 
                    <asp:Label ID="Label85" runat="server" Text="Consulatul :"></asp:Label>
                </td>
                <td>   
                    <asp:DropDownList ID="editHolidaysConsulatDDL" runat="server" Height="24px" Width="430px"  Enabled = "false" >  </asp:DropDownList>
                </td> 
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label86" runat="server" Text="Data :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="editHolidaysDataTextBox" runat="server" Enabled = "false"></asp:TextBox>
                    <ajaxToolkit:CalendarExtender ID="editHolidaysDataCalendarExtender" runat="server"  TargetControlID="editHolidaysDataTextBox" />
                </td>            
            </tr>  
               
            <tr>
                <td>
                    <asp:Label ID="Label89" runat="server" Text="Work Time From :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="editHolyDaysWorkTimeFromTextBox" runat="server" Width="130px" ValidationGroup="MKE" ></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="editHolyDaysWorkTimeFromMaskedEditExtender1" runat="server"
                        TargetControlID="editHolyDaysWorkTimeFromTextBox" 
                        Mask="99:99"
                        MessageValidatorTip="true"
                        OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError"
                        MaskType="Time"
                        AcceptAMPM="True"
                        ErrorTooltipEnabled="True" />
                    <ajaxToolkit:MaskedEditValidator ID="editHolyDaysWorkTimeFromMaskedEditValidator1" runat="server"
                        ControlExtender="editHolyDaysWorkTimeFromMaskedEditExtender1"
                        ControlToValidate="editHolyDaysWorkTimeFromTextBox"
                        IsValidEmpty="False"
                        EmptyValueMessage="Introduceti va rog Timpul"
                        InvalidValueMessage="Timp incorect"
                        Display="Dynamic"
                        TooltipMessage="Introduceti timpul"
                        EmptyValueBlurredText="*"
                        InvalidValueBlurredMessage="*"
                        ValidationGroup="MKE"/>
                </td>            
            </tr>  

            <tr>
                <td>
                    <asp:Label ID="Label90" runat="server" Text="Work Time To :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="editHolyDaysWorkTimeToTextBox" runat="server" Width="130px" ValidationGroup="MKE" ></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="editHolyDaysWorkTimeToMaskedEditExtender1" runat="server"
                        TargetControlID="editHolyDaysWorkTimeToTextBox" 
                        Mask="99:99"
                        MessageValidatorTip="true"
                        OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError"
                        MaskType="Time"
                        AcceptAMPM="True"
                        ErrorTooltipEnabled="True" />
                    <ajaxToolkit:MaskedEditValidator ID="editHolyDaysWorkTimeToMaskedEditValidator1" runat="server"
                        ControlExtender="editHolyDaysWorkTimeToMaskedEditExtender1"
                        ControlToValidate="editHolyDaysWorkTimeToTextBox"
                        IsValidEmpty="False"
                        EmptyValueMessage="Introduceti va rog Timpul"
                        InvalidValueMessage="Timp incorect"
                        Display="Dynamic"
                        TooltipMessage="Introduceti timpul"
                        EmptyValueBlurredText="*"
                        InvalidValueBlurredMessage="*"
                        ValidationGroup="MKE"/>
                </td>            
            </tr> 
                  
            <tr>
                <td>
                    <asp:Label ID="Label92" runat="server" Text="Work Hours :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="editHolyDaysWorkHoursTextBox" runat="server"></asp:TextBox>
                </td>            
            </tr> 

        </table>

        <asp:Button ID="editHolyDaysSaveButton" runat="server" Text="Save"  onclick="editHolyDaysSaveButton_Click"  CssClass="button" />

        &nbsp;&nbsp;  

        <asp:Label ID="Label87" runat="server" Text="OR"></asp:Label>

        &nbsp;&nbsp;

        <asp:Button ID="editHolyDaysCancelButton" runat="server" Text="Cancel" onclick="editHolyDaysCancelButton_Click"  />                        
    </asp:Panel>

    <asp:Panel ID="addNewHolidayPanel" runat="server" Visible="False">
        <table>            
            <tr> 
                <td> 
                    <asp:Label ID="Label94" runat="server" Text="Consulatul :"></asp:Label>
                </td>
                <td>   
                    <asp:DropDownList ID="addNewHolidayConsulatDDL" runat="server" Height="24px" Width="430px" >  </asp:DropDownList>
                </td> 
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label95" runat="server" Text="Data :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="addNewHolidayDataTextBox" runat="server"></asp:TextBox>
                    <ajaxToolkit:CalendarExtender ID="addNewHolidayDataCalendarExtender" runat="server"  TargetControlID="addNewHolidayDataTextBox" />
                </td>            
            </tr>  
               
            <tr>
                <td>
                    <asp:Label ID="Label96" runat="server" Text="Work Time From :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="addNewHolidayWorkTimeFromTextBox" runat="server" Width="130px" ValidationGroup="MKE"></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="addNewHolidayWorkTimeFromMaskedEditExtender3" runat="server"
                        TargetControlID="addNewHolidayWorkTimeFromTextBox" 
                        Mask="99:99"
                        MessageValidatorTip="true"
                        OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError"
                        MaskType="Time"
                        AcceptAMPM="True"
                        ErrorTooltipEnabled="True" />
                    <ajaxToolkit:MaskedEditValidator ID="addNewHolidayWorkTimeFromMaskedEditValidator3" runat="server"
                        ControlExtender="addNewHolidayWorkTimeFromMaskedEditExtender3"
                        ControlToValidate="addNewHolidayWorkTimeFromTextBox"
                        IsValidEmpty="False"
                        EmptyValueMessage="Introduceti va rog Timpul"
                        InvalidValueMessage="Timp incorect"
                        Display="Dynamic"
                        TooltipMessage="Introduceti timpul"
                        EmptyValueBlurredText="*"
                        InvalidValueBlurredMessage="*"
                        ValidationGroup="MKE"/>
                </td>            
            </tr>  

            <tr>
                <td>
                    <asp:Label ID="Label98" runat="server" Text="Work Time To :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="addNewHolidayWorkTimeToTextBox" runat="server" ></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="addNewHolidayWorkTimeToMaskedEditExtender2" runat="server"
                        TargetControlID="addNewHolidayWorkTimeToTextBox" 
                        Mask="99:99"
                        MessageValidatorTip="true"
                        OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError"
                        MaskType="Time"
                        AcceptAMPM="True"
                        ErrorTooltipEnabled="True" />
                    <ajaxToolkit:MaskedEditValidator ID="addNewHolidayWorkTimeToMaskedEditValidator2" runat="server"
                        ControlExtender="addNewHolidayWorkTimeToMaskedEditExtender2"
                        ControlToValidate="addNewHolidayWorkTimeToTextBox"
                        IsValidEmpty="False"
                        EmptyValueMessage="Introduceti va rog Timpul"
                        InvalidValueMessage="Timp incorect"
                        Display="Dynamic"
                        TooltipMessage="Introduceti timpul"
                        EmptyValueBlurredText="*"
                        InvalidValueBlurredMessage="*"
                        ValidationGroup="MKE"/>
                </td>            
            </tr> 
                  
            <tr>
                <td>
                    <asp:Label ID="Label100" runat="server" Text="Work Hours :"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="addNewHolidayWorkHoursTextBox" runat="server"></asp:TextBox>
                </td>            
            </tr> 

        </table>

        <asp:Button ID="addNewHolidaySaveButton" runat="server" Text="Save" onclick="addNewHolidaySaveButton_Click"  />

        &nbsp;&nbsp;  

        <asp:Label ID="Label101" runat="server" Text="OR"></asp:Label>

        &nbsp;&nbsp;

        <asp:Button ID="addNewHolidayCancelButton" runat="server" Text="Cancel" onclick="addNewHolidayCancelButton_Click"  CssClass="button" />                        
    </asp:Panel>

    <asp:Panel ID="VisualizareProgramariPanel" runat="server" Visible="False">  
        <table>
            <tr> 
                <td> 
                    <asp:Label ID="Label1" runat="server" Text="Consulatul :"></asp:Label>
                </td>
                <td>   
                    <asp:DropDownList ID="VisualizareProgramariConsulatDDL" runat="server" Height="24px" Width="430px"  AutoPostBack="True" >  </asp:DropDownList>
                </td> 
            </tr>

            <tr>                 
                <td> 
                    <asp:Label ID="Label3" runat="server" Text="Data :"></asp:Label>
                </td>
                <td>   
                    <asp:Calendar ID="VisualizareProgramariCalendar" runat="server" 
                        onselectionchanged="VisualizareProgramariCalendar_SelectionChanged" 
                        Width="200px"></asp:Calendar>
                </td> 
            </tr>

             <tr>                 
                <td> 
                    <asp:CheckBox ID="VisualizareProgramariCheckBox" runat="server" AutoPostBack="true" oncheckedchanged="VisualizareProgramariCheckBox_CheckedChanged" />
                    <asp:Label ID="Label4" runat="server" Text="Ora programării :"></asp:Label>
                </td>
                <td>   
                    <asp:TextBox ID="VisualizareProgramariOraTextBox" runat="server" Width="130px" ValidationGroup="MKE" Enabled="false"></asp:TextBox>
                    <ajaxToolkit:MaskedEditExtender ID="VisualizareProgramariOraMaskedEditExtender" runat="server"
                        TargetControlID="VisualizareProgramariOraTextBox" 
                        Mask="99:99"
                        MessageValidatorTip="true"
                        OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError"
                        MaskType="Time"
                        AcceptAMPM="True"
                        ErrorTooltipEnabled="True" />
                    <ajaxToolkit:MaskedEditValidator ID="VisualizareProgramariOraMaskedEditValidator" runat="server"
                        ControlExtender="VisualizareProgramariOraMaskedEditExtender"
                        ControlToValidate="VisualizareProgramariOraTextBox"
                        IsValidEmpty="False"
                        EmptyValueMessage="Introduceti va rog Timpul"
                        InvalidValueMessage="Timp incorect"
                        Display="Dynamic"
                        TooltipMessage="Introduceti timpul"
                        EmptyValueBlurredText="*"
                        InvalidValueBlurredMessage="*"
                        ValidationGroup="MKE"/>
                    <asp:Button ID="okFilterTimeButton" runat="server" Text="OK" Enabled="false" 
                        onclick="VisualizareProgramariCalendar_SelectionChanged" />
                </td> 
            </tr>

            <tr> 
                <td> 
                    <asp:CheckBox ID="VisualizareProgramariServisCheckBox" runat="server" 
                        AutoPostBack="true" 
                        oncheckedchanged="VisualizareProgramariServisCheckBox_CheckedChanged" />
                    <asp:Label ID="Label2" runat="server" Text="Serviciu :"></asp:Label>
                </td>
                <td>   
                    <asp:DropDownList ID="VisualizareProgramariServiceDDL" runat="server" 
                        Height="24px" Width="230px"  AutoPostBack="True" Enabled="False" 
                        onselectedindexchanged="VisualizareProgramariServiceDDL_SelectedIndexChanged" >  </asp:DropDownList>
                </td> 
            </tr>
        </table>
        <br />

        <div id="ViewProgramari">
            <strong>
            <asp:Label ID="VisualizareaProgramarilorLabel" runat="server" 
                Text="Lista programărilor "></asp:Label>
            <br />
            </strong>
            <asp:GridView ID="VisualizareProgramariGridView" runat="server" 
                AllowPaging="True" AlternatingRowStyle-CssClass="alt" 
                AutoGenerateColumns="False" CellPadding="4" CssClass="mGrid" 
                EnableModelValidation="True" HorizontalAlign="Justify" 
                PagerStyle-CssClass="pgr" PageSize="100" Width="100%">
                <Columns>
                    <asp:TemplateField HeaderText="Nr.">
                        <ItemTemplate>
                            <%# Container.DataItemIndex + 1 %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="PROG_ID" HeaderText="NR PROGRAMARE" 
                        HtmlEncode="False" />
                    <asp:BoundField DataField="NUME" HeaderText="NUME" HtmlEncode="False" />
                    <asp:BoundField DataField="PRENUME" HeaderText="PRENUME" HtmlEncode="False" />
                    <asp:BoundField DataField="NUME ANTERIOR" HeaderText="NUME ANTERIOR" 
                        HtmlEncode="False" />
                    <asp:TemplateField HeaderText="DATA NASTERE">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" 
                                Text='<%# ((Eval("DATA NASTERE") != null && Eval("DATA NASTERE") is DateTime) ?  ((DateTime)Eval("DATA NASTERE")).ToShortDateString() : "") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="PASAPORT" HeaderText="PASAPORT" HtmlEncode="False" />
                    <asp:TemplateField HeaderText="DATA SOLICITARII">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" 
                                Text='<%# ((Eval("DataSolicitarii") != null && Eval("DataSolicitarii") is DateTime) ?  ((DateTime)Eval("DataSolicitarii")).ToShortDateString() : "") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="OraProgramarii" HeaderText="ORA PROGRAMARII" 
                        HtmlEncode="False" />
                    <asp:BoundField DataField="Serviciu" HeaderText="SERVICIU" HtmlEncode="False" />
                </Columns>
            </asp:GridView>
        </div>

        
        <asp:Button ID="Button1" runat="server" Text="Printează Lista" 
            onclientclick="javascript:CallPrint('ViewProgramari');" />

    </asp:Panel>

</asp:Content>
<asp:Content ID="Content1" runat="server" contentplaceholderid="HeadContent">
    <style type="text/css">
        .auto-style1 {
            font-size: large;
            color: #3DA6B9;
        }
    </style>
</asp:Content>

